package web.wm;

import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;
import web.jht.Animal;

import java.lang.reflect.Field;

public class AppTest {
    public static void main(String[] args) throws Exception{

        Class<?> a = Animal.class;
        Object o = a.newInstance();
        Field[] fields = a.getDeclaredFields();

        for (Field field : fields) {
            if (field.getType().equals(String.class)) {
                field.setAccessible(true);
                String s = RandomStringUtils.randomAlphabetic(6);
                field.set(o,s);
            }
            if (field.getType().equals(Double.class)) {
                field.setAccessible(true);
                Double d = RandomUtils.nextDouble();
                field.set(o,d);
            }
        }
        System.out.println(o);
    }
}

